package test.designpattern.simpleFactory;

public class Client {
    public static void main(String[] args) {
        ICalculator calculator1 = CalculatorFactory.create("+");
        ICalculator calculator2 = CalculatorFactory.create("-");
        ICalculator calculator3 = CalculatorFactory.create("*");
        ICalculator calculator4 = CalculatorFactory.create("/");
        try {
            double result1 = calculator1.getResult(6, 2);
            System.out.println(result1);
            double result2 = calculator2.getResult(result1, 2);
            System.out.println(result2);
            double result3 = calculator3.getResult(result2, 2);
            System.out.println(result3);
            double result4 = calculator4.getResult(result3, 2);
            System.out.println(result4);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
